package com.example.zk2_lx.login;

import androidx.lifecycle.MutableLiveData;

import com.example.zk2_lx.mvvm_base.BaseRepo;
import com.hyphenate.EMCallBack;

public class LoginRepo extends BaseRepo {

    public void login(String name, String pwd, MutableLiveData<String> success,MutableLiveData<String> fail){
        emClient.logout(true);
        emClient.login(name, pwd, new EMCallBack() {
            @Override
            public void onSuccess() {
                success.postValue("登录成功");
            }

            @Override
            public void onError(int code, String error) {
                fail.postValue("登录失败："+error);
            }
        });
    }
}
